Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-6607 - Input/Output Node - part 1 #14987

Merged
merged 12 commits into from
Mar 15, 2024
Merged

Conversation

dnenov
Copy link
Collaborator

@dnenov dnenov commented Feb 29, 2024

Purpose

This is the initial work regarding a new Input/Output node in Dynamo. The main function of the node is to enable custom type allocation (for all Dynamo-supported data types) and plays an important role in the larger ecosystem of infrastructural nodes inside Dynamo. On the level of the active graph, the node is a 'pass-through' node, meaning that the output is the same as the input.

The node has 4 main 'inputs', although only one that allows passing data form downstream:

  • InputValue - a downstream node the output of which will be evaluated
  • TypeId - a dropdown containing all Dynamo supported data type
  • Context - a boolean flag specifying if the input is a single item or an ArrayList (only homogenous single-array lists (supports inheritance) are allowed)
  • AutoMode - a boolean flag that allows the user to 'freeze' the node DataType

image

Current state of affairs - node output is the validation result

DynamoSandbox_X6At4mW0MX

This PR contains the main utility function that is used to evaluate the input. It also contains the starting bits of the node View customization (can be split if it's confusing).

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

  • starting with the model and the test suite
  • now types are contained inside an enum
  • added the basic primitives to the test structure, including lists checks
  • reworked the node to start getting the customization going (and make sense of the whole thing)
  • created hierarchical container capable of tracking type inheritance
  • finished all geometry tests
  • finished all primitive date type tests
  • finished all inheritance tests (works on individual and on list level)
  • addressed comments, further refactor and simplification

Reviewers

@saintentropy
@twastvedt

FYIs

@mjkkirschner

dnenov and others added 9 commits February 5, 2024 15:36
- starting with the model and the test suite
- now types are contained inside an enum
- added the basic primitives to the test structure, including lists checks
- reworked the node to start getting the customization going (and make sense of the whole thing)
- created hierarchical container capable of tracking type inheritance
- added all geometry tests
- finished all primitive date type tests
This reverts commit 1621855.
- completed tests checking inf inheritance works on individual and on list level
- added a few additional comments
- additional test checking if inheritance stops at the desired level (ie. `Cone` does not inherit from `Curve`)
Copy link

github-actions bot commented Feb 29, 2024

UI Smoke Tests

Test: success. 2 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests - net8.0

Copy link
Contributor

@twastvedt twastvedt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good! Not sure what you know about and is on your todo list and what is a useful suggestion. We also don't need to make everything just right in this PR.

src/Libraries/CoreNodeModels/DefineData.cs Outdated Show resolved Hide resolved
src/Libraries/CoreNodeModels/DefineData.cs Outdated Show resolved Hide resolved
src/Libraries/CoreNodes/Data.cs Outdated Show resolved Hide resolved
test/DynamoCoreTests/DSCoreDataTests.cs Outdated Show resolved Hide resolved

[Test]
[Category("UnitTests")]
public void IsSupportedGeometryDataType()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder at the exhaustiveness of these tests. Do we really need to check that every type in the dropdown validates? Is it useful to keep the full list of supported types here and in the dropdown items definition? Why isn't it enough to just check that the characteristics of the system work - test inheritance, is list/is not list, a type we know is not in the dropdown list, heterogenous list values?
Caveat: I don't have a lot of experience with TDD. Just seems like a lot of effort here for not a lot of validation value. @mjkkirschner?

- removed dictionary in favor of list of datatypes
- renamed methods to better suit the specificity of the node functionality they were serving
@dnenov dnenov marked this pull request as ready for review March 7, 2024 17:24
@deepakanand deepakanand changed the title Input/Output Node - part 1 DYN-6607 - Input/Output Node - part 1 Mar 14, 2024
@dnenov dnenov merged commit c90f105 into DynamoDS:master Mar 15, 2024
22 checks passed
/// A static dictionary for all Dynamo supported data types
/// </summary>
/// <returns>The dictionary containing the supported data types</returns>
public static List<DataNodeDynamoType> GetDataNodeDynamoTypeList()
Copy link
Member

@mjkkirschner mjkkirschner Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this public?
why is it a list instead of an ienumerable or readonly collection? Do you expect callers to add types to it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method seems inefficient, whenever this method is called it re evaluates allocating this list and allocating all these types... seems this could be done at compile time using an initializer - though I am not sure.

[IsVisibleInDynamoLibrary(false)]
public static bool IsSupportedDataNodeDynamoType([ArbitraryDimensionArrayImport] object inputValue, string typeString, bool isList)
{
var type = GetDataNodeDynamoTypeList().FirstOrDefault(x => x.Type.ToString().Equals(typeString)).Type;
Copy link
Member

@mjkkirschner mjkkirschner Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not great, every time the node's AST is constructed we revaluate and reallocate the list of types, then do string comparisons? I think doing type comparisons will be much faster.

twastvedt added a commit that referenced this pull request Apr 10, 2024
QilongTang pushed a commit that referenced this pull request Apr 15, 2024
* Revert "DYN-6607 - Input/Output Node - part 1 FIX (#15037)"

This reverts commit 97e2d46.

# Conflicts:
#	test/Tools/NodeDocumentationMarkdownGeneratorTests/MarkdownGeneratorCommandTests.cs

* Revert "DYN-6607 - Input/Output Node - part 1 (#14987)"

This reverts commit c90f105.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants